﻿using System;
using System.Windows.Forms;

namespace QuickRunCore
{
    public partial class FrmAddGroup : Form
    {
        public Label lblTitle;
        public TextBox txtGroupName;

        public FrmAddGroup()
        {
            InitializeComponent();
            lblTitle = label1;
            txtGroupName = textBox1;
            txtGroupName.KeyUp += txtGroupName_KeyUp;
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.Cancel;
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.OK;
        }

        private void txtGroupName_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                btnOK_Click(btnOK, null);
            }
            if (e.KeyCode == Keys.Escape)
            {
                btnClose_Click(btnClose, null);
            }
        }

        private void skinForm1_CloseButtonClick(object sender, EventArgs e)
        {
            DialogResult = DialogResult.Cancel;
        }
    }
}
